package com.ss.android.common.dialog;

import android.content.Context;
import android.os.IBinder;
import android.view.View;
import android.view.WindowManager;

public abstract class WindowBase {
    WindowManager a;
    public WindowManager.LayoutParams b;
    View c;
    boolean d;
    private Context e;
    private long f;

    public WindowBase(Context arg3) {

        this.e = arg3;
        this.a = (WindowManager) this.e.getSystemService(Context.WINDOW_SERVICE);
        this.b = this.a();
        if (this.b == null) {
            throw new NullPointerException("initLayoutParams() can\'t return null");
        }
    }

    public final void a(View arg4, IBinder arg5) {
        if (!this.d && !this.b()) {
            this.c = arg4;
            if (this.a == null) {
                return;
            }

            if (this.c == null) {
                return;
            }
            try {
                if (arg5 != null) {
                    this.b.token = arg5;
                }
                this.b.x = 0;
                this.b.y = 0;
                this.a.addView(this.c, this.b);
                this.d = true;

            } catch (Exception v0) {
            }
        }
    }

    public abstract WindowManager.LayoutParams a();

    final boolean b() {
        boolean v0_1;
        long v0 = System.currentTimeMillis();
        if (v0 - this.f < 20) {
            v0_1 = true;
        } else {
            this.f = v0;
            v0_1 = false;
        }

        return v0_1;
    }
}

